/**
 *
 * 复选框组件
 *
 * */
import {ICellInputProps} from "./ICellInputProps";
import {Checkbox as AntCheckbox} from 'antd';

export interface CheckboxExtraProps {
}

export function Checkbox(props: ICellInputProps<boolean> & CheckboxExtraProps) {
	const {value, onChange, disabled} = props;

	let checked = !!value;
	return (
		<AntCheckbox checked={checked} onChange={(e) => {
			onChange(e.target.checked);
		}} disabled={disabled}/>
	)
}

export function CheckboxDetail(props: {checked: boolean}) {
	return <AntCheckbox checked={props.checked} disabled onChange={() => null}/>
}
